package dk.dashboardFP.panels.loggerPanel {
	import dk.dashboardFP.panels.subPanels.ui.windowSubPanelUI.IWindowContent;
	import dk.dashboardFP.panels.subPanels.ui.windowSubPanelUI.WindowContentEvent;

	import flash.display.Sprite;
	import flash.geom.Point;

	/**
	 * @author josef
	 */
	public class FilterWindowContent extends Sprite implements IWindowContent {
		private var _intCountY : Number = 0;
		private var _levelMarkers : LevelMarkers;
		private var _logFilterItems : Array;
		private var _pWindowDimentions : Point;

		public function FilterWindowContent() {
			setupElements();
		}

		private function setupElements() : void {
			
			// setup colorcodes 
			_levelMarkers=new LevelMarkers();
			addChild(_levelMarkers);
			
			_levelMarkers.y=5;
			
			//  
			_intCountY=20;
			
			// item container 
			_logFilterItems=[];
		}

		public function addFilter(doLogFilterItem : LogFilterItem) : void {
			
			addChild(doLogFilterItem);
			doLogFilterItem.y=_intCountY;
			
			doLogFilterItem.windowWidth = _pWindowDimentions.x;
			
			_logFilterItems[_logFilterItems.length] = doLogFilterItem;
			_intCountY = doLogFilterItem.nBottomLine;
			
			dispatchEvent(new WindowContentEvent(WindowContentEvent.CONTENT_DIMENTIONS_CHANGE));
		}
		
		override public function set height(value : Number) : void {
			_intCountY;
		}

		public function setWindowDimentions(pWindowDimentions : Point) : void {
			
			_pWindowDimentions = pWindowDimentions;
			updateWidth();
		}

		private function updateWidth() : void {
			
			_levelMarkers.x = _pWindowDimentions.x-50;
			
			for each (var item : LogFilterItem in _logFilterItems) {
				item.windowWidth = _pWindowDimentions.x;
			}
		}

		public function set nWindowWidth(nWindowWidth : Number) : void {
		}
		
		public function set nWindowHeight(nWindowHeight : Number) : void {
		}
	}
}
